﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace 站点地图设计_面包屑.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewBag.Message = "修改此模板以快速启动你的 ASP.NET MVC 应用程序。";

            StringBuilder str = new StringBuilder();
            Models.BannerModel.DataInit().ForEach(i =>
            {
                //RouteValueDictionary routeValueDictionary = new RouteValueDictionary();
                //if (!string.IsNullOrWhiteSpace(i.RouteData))
                //{
                //    Array.ForEach(i.RouteData.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), j =>
                //    {
                //        routeValueDictionary.Add(j.Split(new char[] { '=' })[0], j.Split(new char[] { '=' })[1]);
                //    });
                //}
                str.AppendFormat("<a href={0}>{1}</a>"
                    , Url.Action(i.ActionName, i.ControllerName, i.RouteData)
                    , i.Title);
            });

            ViewBag.Banner = str.ToString();

            return View();
        }

        public ActionResult About()
        {
            ViewBag.Message = "你的应用程序说明页。";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "你的联系方式页。";

            return View();
        }
    }
}
